<template>
	<view class="">
		<view v-if="!isCaptureScreen" class="qrcode-container display-flex-column">
			<view style="color: #000000;font-weight: 600;font-size: 16px;margin: 12px 0;">贵阳公共交通乘车码</view>

			<view>
				<image :src="qrSrc" mode="scaleToFill" style= "height: 210px; width: 210px;"></image>
			</view>
			<view class="row" style="font-size: 10px;justify-content: center;align-items: center;margin: 8px 0;color: #999;">
				<text class='iconfont iconshuaxin'></text>
				<text>每分钟自动刷新，连续使用请</text>
				<text style="color: #007AFF;">手动刷新</text>
			</view>
		</view>
		<view v-else class="qrcode-container display-flex-column">
			<view style="color: #000000;font-weight: 600;font-size: 16px;margin: 12px 0;">贵阳公交早晚餐券</view>
			 <icon type="warn" size="40" style="margin:15px 0;"/>
			 <text style="font-size: 16px;color: #000;font-weight: 600;margin-bottom: 10px;">请勿截图使用早晚餐券</text>
			 <text style="color: #878787;font-size: 10px;">仅限本人使用，截图使用经核实将会影响功能</text>
			 <u-button @click="showTicketAgain" plain type="error" :custom-style="customStyle" shape="circle" >知道了</u-button>

			
		</view>
		<z-navigation></z-navigation>
		
	<!-- 	<tn-tabbar
		   activeColor="#838383"
		   inactiveColor="#AAAAAA"
		   activeIconColor="#FFFFFF"
		   :animation="true"
		   :safeAreaInsetBottom="true"
		 ></tn-tabbar> -->
	</view>
</template>
<script>

	var util = require('@/common/js/util.js');
	var add = util.add;
	var mul = util.mul;
	var validateIdCard = util.validateIdCard
	var _formatFloat = util.formatFloat;
	export default {
		components: {
			
		},
		data() {
			return {
				customStyle: {
						marginTop: '20px', // 注意驼峰命名，并且值必须用引号包括，因为这是对象
						height: "35px",
						marginBottom: '20px',
						width: '30%',
						alignSelf: 'center',
					},
				isCaptureScreen:false,
				qrSrc:'',
			}
		},
		onLoad(options) {
			let that = this
			uni.onUserCaptureScreen(function() {
			    that.isCaptureScreen = true
			});
		},
		onUnload() {
			uni.setScreenBrightness({
			    value: 0.4,
			    success: function () {
			        console.log('success');
			    }
			});
		},

		onReady() {
			setTimeout(function(){
				uni.setScreenBrightness({
				    value: 1,
				    success: function () {
				        console.log('success');
				    }
				});
			},1000)

		},
		methods: {
			// 重新刷新票
			showTicketAgain:function(){
				this.isCaptureScreen=false
			}
		},


	}
</script>

<style>
/* 	page {
		background-image: linear-gradient(#0c79ff, #0c79ff);
	} */

	.qrcode-container {
		background-color: #FFF;
		border-radius: 8rpx;
		margin: 20px 30px;
		text-align: center;
	}
</style>
